import { pubRequire } from '@utils/public'
const baseUrl = '/homes'
//作业维护列表
export function getPreserveList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callbBack, errBack)
}
//批量删除
export function delItem(obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl}`, obj, callbBack, errBack)
}
//我的发布列表
export function getMineList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/me`, obj, callbBack, errBack)
}
//我的发布-根据学院id,获取课程列表
export function courseList(obj, callbBack, errBack) {
  return pubRequire('get', `/courses`, obj, callbBack, errBack)
}
//我的发布-根据课程id,获取获取期列表
export function stageList(courseId, callbBack, errBack) {
  return pubRequire('get', `/courses/${courseId}/stage`, '', callbBack, errBack)
}
//我的发布-根据期次id,获取作业任务列表
export function taskIdList(stageId, obj, callbBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/stages/${stageId}/tasks`,
    obj,
    callbBack,
    errBack
  )
}
//我的发布-发布
export function pubJob(obj, callbBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callbBack, errBack)
}
//我的发布-编辑-获取表单详情
export function getEditJobDetail(id, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, '', callbBack, errBack)
}
//我的发布-编辑-确认提交
export function pubEditJob(homeId, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/${homeId}`, obj, callbBack, errBack)
}
//获取最新编辑者
export function editor(id, callbBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/${id}/latest-editors`,
    '',
    callbBack,
    errBack
  )
}
//修改虚拟分享量
export function changeShare(id, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/share-counts`,
    obj,
    callbBack,
    errBack
  )
}
//修改虚拟分享量
export function changePlay(id, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${id}/play-counts`,
    obj,
    callbBack,
    errBack
  )
}
//单个删除
export function delSingle(id, obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl}/${id}`, obj, callbBack, errBack)
}
//置顶
export function top(id, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/${id}/top`, obj, callbBack, errBack)
}
//取消置顶
export function unTop(id, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/un-top/${id}`, '', callbBack, errBack)
}
//作业要求详细
export function getTaskDetail(taskId, obj, callbBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/tasks/${taskId}`,
    obj,
    callbBack,
    errBack
  )
}
